home *** CD-ROM | disk | FTP | other *** search
/ POINT Software Programming / PPROG1.ISO / pascal / swag / tsr.swg / 0016_More TSR Stuff.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1993-11-02  |  2.1 KB  |  53 lines

  1. {
  2. LOU DUCHEZ
  3.  
  4. >I recently wrote a short utility in TP.  I want to make it a TSR
  5. >which can be activated by a hotkey (like ALT-R).  Do I need to
  6. >redirect the Keyboard INT to my Program?
  7.  
  8. Right on the nose.
  9.  
  10. >if so, then where does my Program direct the INT after that?
  11.  
  12. To the OLD keyboard interrupt.  You can use the GetIntVec to find
  13. where the interrupt originally pointed; and trust me, it's a royal
  14. pain in the keister to Program your own.  (Note: you'll want to
  15. execute a PUSHF instruction before calling the "old" interrupt;
  16. easily done With the built-in Assembler: Asm PUSHF end.)
  17.  
  18. Now, For reading the Alt-R: you can get the "Alt" key from
  19. memory location $0040:$0017.  It Records the Alt key, shift keys,
  20. caps lock, etc.  Each bit sets/reports whether the key is active or
  21. inactive ("1" = "active").  Like so:
  22.  
  23. Const insByte = $80;  capsByte = $40;  numByte   = $20;  scrollByte = $10;
  24.       altByte = $08;  ctrlByte = $04;  lshftByte = $02;  rshftByte  = $01;
  25.  
  26. Var keyboardstat: Byte Absolute $0040:$0017;
  27.  
  28. To test if Alt is on, see if this expression evaluates to "True":
  29.  
  30.       keyboardstat and altByte = altByte
  31.  
  32. As For the "R", check port $60 (the keyboard port) For scan code $13.
  33. (Maybe ya oughtta find a complete list of the scan codes.)
  34.  
  35. >Also, I want my Window to disappear when my Program
  36. >is finished (and the previous screen to come back).
  37. >How can I do this?
  38.  
  39. Store the old screen into memory.  Hint: on Mono systems, it's the
  40. 4000 Bytes starting at b000:0000; on color, it's the 4000 starting
  41. at b800:0000.  Use the "Move" Procedure first to move the 4000 Bytes
  42. to an Array of 4000 Characters, then use "Move" to move the 4000 Bytes
  43. back to the video location.
  44.  
  45. >  (BTW, I could do all this on the Commodore 64 back in the good 'ol
  46. >days when the 64 was king.  Life was much simpler then).
  47.  
  48. Yeah, I can hear ya now: "Oh you spoiled kids.  When I started in
  49. computers, we had only 64k to work With, and we LIKED it!  And we
  50. didn't waste our money on a separate 'monitor', oh no! we just hooked
  51. our computers up to the TV.  Damn kids these days."
  52. }
  53.